

clear
set more off

cap log close
log using $logdir/analysis/f1099misc_counts.log, replace


clear
set odbcmgr REDACTED

odbc list
#delimit ;

odbc load, exec("


            select 
					count(*) as n,
					case when REDACTED in('G','P') then 1 else 0 end as paper,
					REDACTED as year
				from REDACTED
				where REDACTED between 2010 and 2019
				group by paper, year
				order by paper, year;
	") multistatement
	dsn("REDACTED") user($usr) password($pwd) sqlshow;
#delimit cr

destring n, replace force

qui replace n = n/10^6

twoway connected n year if paper == 0 || ///
    connected n year if paper == 1, lpattern("--") msymbol(circle_hollow) ///
    legend(order(1 "Electronic" 2 "Paper")) scheme(s1color) ///
    ytitle("Counts of Form 1099-misc (millions)") ///
	xtitle("Year")  
graph export "$outdir/figures/f1099misc_counts.eps", replace
graph export "$outdir/figures/f1099misc_counts.pdf", replace

cap log close




